#include<cstdio>
#include<cstring>
using namespace std;

int main(){
    const int Mod = 1000000007;
    int n, ans = 1;
    int cnt[27] = {0};
    char s[27];
    
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        int len;
        
        scanf("%s", s);
        len = strlen(s);
        cnt[len]++;
        ans = (long long)ans * cnt[len] % Mod;
    }
    printf("%d\n", ans);
    return 0;
}
